package com.sohoometer.station.dao;

import java.util.List;

import org.hibernate.SessionFactory;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.nari.coreframe.dao.hibernate3.GenericDaoImpl;
import com.sohoometer.station.bean.WaterMeterInfo;

@Repository("waterMeterInfoDao")
public class WaterMeterInfoDaoImpl extends GenericDaoImpl<WaterMeterInfo, String> implements WaterMeterInfoDao {
	@Autowired
	public WaterMeterInfoDaoImpl(SessionFactory sessionFactory) {
		setSessionFactory(sessionFactory);
	}

	@Override
	public List<WaterMeterInfo> queryWaterInfoByUserId(String id) throws Exception {
		DetachedCriteria criteria = createDetachedCriteria().add(Restrictions.eq("userID", id));
		return queryEntityListCriteria(criteria);
	}
}
